package com.yangst.service.common.enums;

/**
 * Created by YST on 2018/4/13.
 */
public enum IsDeleteEnum {
    EXIST(1,"正常"),
    DELETE(-1,"删除");

    private Integer val;
    private String desc;

    private IsDeleteEnum (Integer val,String desc) {
        this.val = val;
        this.desc = desc;
    }

    public Integer getVal() {
        return val;
    }
    public String getDesc() {
        return desc;
    }

    public static IsDeleteEnum getEnumByNumber(Integer val){
        if (val == null)
            return null;
        for (IsDeleteEnum tSORNOTEnum : IsDeleteEnum.values()) {
            if (tSORNOTEnum.getVal().equals(val))
                return tSORNOTEnum;
        }
        return null;
    }

    public static IsDeleteEnum getEnumByDesc(String desc){
        if (desc == null)
            return null;
        for (IsDeleteEnum tSORNOTEnum : IsDeleteEnum.values()) {
            if (tSORNOTEnum.getDesc().equals(desc))
                return tSORNOTEnum;
        }
        return null;
    }
}
